package org.wltea.analyzer.lucene;

import java.io.Closeable;
import java.io.StringReader;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.util.IOUtils;

public final class IKAnalyzer extends Analyzer {
    private boolean useSmart;

    public boolean useSmart() {
        return this.useSmart;
    }

    public void setUseSmart(boolean useSmart) {
        this.useSmart = useSmart;
    }

    public IKAnalyzer() {
        this(false);
    }

    protected TokenStreamComponents createComponents(String arg0) {
        StringReader reader = null;

        TokenStreamComponents var4;
        try {
            reader = new StringReader(arg0);
            IKTokenizer it = new IKTokenizer(reader);
            var4 = new TokenStreamComponents(it);
        } finally {
            IOUtils.closeWhileHandlingException(new Closeable[]{reader});
        }

        return var4;
    }

    public IKAnalyzer(boolean useSmart) {
        this.useSmart = useSmart;
    }
}
